#pragma once
#include <string>
#include <list>
using namespace std;
class CClient;
class CIocpWrapper
{
public:
	CIocpWrapper();
	virtual ~CIocpWrapper();

private:
	HANDLE m_hiocp;
	bool m_bSvrStop;
	SOCKET m_sockListen;
public:
	bool InitSvr();
	bool CloseSvr();
	bool CreateAcceptSocket(DWORD svrip, short port);
	void WriteLog(string s);

	static unsigned __stdcall ServerWorker(void *p);
	static unsigned __stdcall AcceptWorker(void *p);

	list<CClient*> m_clients;

	void AddClient(CClient* p);
	void DelClient(CClient* p);

	void ProcessIO(CClient* p, LPOVERLAPPED pOverlapped, DWORD dwiosize);
};

